[asp]如何用webeditor读出和修改*.TXT文件

来源:百度知道 编辑:UC知道 时间:2024/09/24 17:13:18
[asp]如何用webeditor读出和修改*.TXT文件
在线等.............

思路:
先读出TXT文件值,然后再调入到编辑器的文本框

给段代码给你:

<% dim news_id
news_id=request("news_id")

Function include(filename)
Dim re,content,fso,f,aspStart,aspEnd
set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.OpenTextFile(server.mappath(filename))
content=f.ReadAll
f.close
set f=nothing
set fso=nothing
set re=new RegExp
re.pattern="^\s*="
aspEnd=1
aspStart=inStr(aspEnd,content,"<%")+2
do while aspStart>aspEnd+1
Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
aspEnd=inStr(aspStart,content,"%\>")+2
Execute(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
aspStart=inStr(aspEnd,content,"<%")+2
loop
include=Mid(content,aspEnd)
set re=nothing
End Function
'读取数据库内容,
news_main=include("/news/newstext/112323.txt")